package com.cgmnx.admin.service.rbac.impl;

import com.cgmnx.admin.common.bean.Limiter;
import com.cgmnx.admin.common.enums.ValidEnumType;
import com.cgmnx.admin.dao.entity.rbac.RoleEntity;
import com.cgmnx.admin.dao.mapper.rbac.RoleMapper;
import com.cgmnx.admin.service.rbac.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author created on 14-3-1 下午7:41
 * @version $Id$
 */
@Service
public class RoleServiceImpl implements RoleService {

//    @Autowired
    private RoleMapper roleMapper;

    @Override
    public int save(RoleEntity entity) {
        return roleMapper.save(entity);
    }

    @Override
    public List<RoleEntity> query(RoleEntity entity) {
        return roleMapper.query(entity);
    }

    @Override
    public RoleEntity queryById(Integer id) {
        return roleMapper.queryById(id);
    }


    @Override
    public int update(RoleEntity entity) {
        return roleMapper.update(entity);
    }

    @Override
    public void updateStatus(List<Integer> idList, ValidEnumType type) {
        roleMapper.updateRoleStatus(idList, type);
    }

    @Override
    public List<RoleEntity> queryByNameAndValid(String name, ValidEnumType type) {
        return roleMapper.queryByNameAndValid(name, type);
    }

    @Override
    public List<RoleEntity> queryPage(String name, ValidEnumType type, Limiter limiter) {
        return roleMapper.queryPage(name, type, limiter);
    }

    @Override
    public Integer count(String name, ValidEnumType type) {
        return roleMapper.count(name, type);
    }

    @Override
    public List<RoleEntity> queryAll() {
        return roleMapper.queryAll(ValidEnumType.VALID);
    }

    @Override
    public List<RoleEntity> queryByUserIdList(List<String> userIdList, ValidEnumType valid) {
        return roleMapper.queryByUserIdList(userIdList, valid);
    }

}
